<template>
<!--公司资料页面 => 社区介绍资料组件-->
<div class="community_introd">
	<div class="title">{{ $lang('COMMUNCITY_INTRODUCE') }}</div>
	<div class="com_nav" >
		<!-- <a 
			href="javascript:;" 
			:class="{ active: activeNav === index }"
			v-for="(item,index) in navInfo" 
			@click="getTeamtype(index)" 
		>{{ $lang(item.name) }}</a> -->
        <a href="javascript:;"  :class="{ active: activeNav === 0 }" @click="getTeamtype(0)" >{{ $lang('FOUNDATION') }}({{map.foundationCount}})</a>
        <a href="javascript:;"  :class="{ active: activeNav === 1 }" @click="getTeamtype(1)" >{{ $lang('OPERATION_TEAM') }}({{map.operationTeamCount}})</a>
        <a href="javascript:;"  :class="{ active: activeNav === 2 }" @click="getTeamtype(2)" >{{ $lang('TECHNICAL_TEAM') }}({{map.technicalTeamCount}})</a>
	</div>
	<detail :teamType="teamType" ref="detail"></detail>
</div>
</template>

<script>
import detail from './communityIntrod/index.vue';
import { gets } from "@/api/api.js";
export default {
	data(){
		return {
			navInfo:['FOUNDATION','OPERATION_TEAM','TECHNICAL_TEAM'],
            map: [],
            activeNav:0,
            teamType:'FOUNDATION'
		}
	},
	methods:{
        async getTeamtype(idx) {
            let that = this
            that.activeNav = idx;
            for (var i = 0; i<that.navInfo.length; i++) {
                if (idx == i) {
                    that.teamType = that.navInfo[i]
                }
            }
            that.$refs.detail.getCommunity(that.teamType)
        },
        async getCommunityteam(idx) {
            let that = this
            try {
                let res = await gets.searchCompanyList("/community/find-team-count.json", {
                    companyId : that.$store.state.common.companyId
                });
                that.map = res.map
            } catch (e) {
                console.log(e)
                throw e;
            }
        },
	},
	components:{
		detail
    },
    created() {
        this.getCommunityteam()
    },
}
</script>

<style>
</style>
